/* eslint-disable */
'use strict';
// import { getSign } from '../utils/index'
const { getSign } = require('../utils/index')

const Service = require('egg').Service;

class MockService extends Service {
  async index(username) {
    return await new Promise((res) => {
      setTimeout(() => {
        switch (username) {
          case '1111':
            res({
              status: true,
              message: '登录成功'
            });
            break;
          default:
            res({
              status: false,
              message: '登录失败，账号或密码不对'
            });
            break;
        }
        res(true);
      }, 1500);
    });
  }

  async userInfo() {
    return await new Promise(res => {
      setTimeout(() => {
        res({
          name: 'lijun',
          age: 27,
          gender: 'male',
          weight: '75kg',
          work: 'it',
          token: 'quhfytcueohgopegheufye9u',
          address: 'china wuhan jiangxia zhifang',
        });
      }, 500);
    });
  }

  async checkSign() {
    const { ctx } = this;
    const { url, header: { timestmap, sign } } = ctx.request;
    const s = getSign(ctx.request)
    return s;
  }

}

module.exports = MockService;
